<?php

namespace App\Admin\Controllers;

use App\Http\Controllers\Controller;
use App\Member;
use Encore\Admin\Controllers\Dashboard;
use Encore\Admin\Layout\Column;
use Encore\Admin\Layout\Content;
use Encore\Admin\Layout\Row;
use Encore\Admin\Widgets\InfoBox;

class HomeController extends Controller
{
    public function index(Content $content)
    {
        return $content
            ->header('后台数据总览')
            ->description('Description...')
            ->row(function (Row $row) {

                $row->column(4, function (Column $column) {
                  $infoBox = new InfoBox('注册总人数', 'users', 'aqua', '/admin/members', Member::all()->count());
                  $column->append($infoBox);
                });

                $row->column(4, function (Column $column) {
                    $infoBox = new InfoBox('已核销卡券', 'bolt', 'yellow', '/admin/members', Member::where('status', 1)->count());
                    $column->append($infoBox);
                });
            });
    }
}
